import { createRouter, createWebHistory } from 'vue-router'
import BeautyApp from '@/views/BeautyApp.vue'
import CarouselDemo from '@/views/samples/CarouselDemo.vue'

const routes = [
  {
    path: '/',
    name: 'BeautyApp',
    component: BeautyApp,
    meta: {
      title: '人像美容'
    }
  },
  {
    path: '/samples/carousel',
    name: 'CarouselDemo',
    component: CarouselDemo,
    meta: {
      title: '轮播图演示'
    }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title || '美容App'
  next()
})

export default router